﻿/**
 * Created by thomas on 2017/9/11.
 */
export default {
  get_m_exchange(state){

      return state.Exchange_mess;
    },
  set_m_exchange(state, obj) {
      state.Exchange_mess = obj;
  },
  change_exchange_click(state, obj) {
      let temp = state.Exchange_mess;     
      temp[obj.index].click_check = !temp[obj.index].click_check;
      state.Exchange_mess = temp;//改变index 的 click 状态
      //true 不进 
      if (temp[obj.index].click_check) {
          state.Post_user_msg.push({ id: obj.id, index: obj.index });
      }
      else {
      //取消点击 就 去掉 朋友信息
          for (let x = 0; x < state.Post_user_msg.length; x++) {
              if (state.Post_user_msg[x].index == obj.index) {
                  console.log(state.Post_user_msg[x])
                  state.Post_user_msg.splice(x, 1);
                  
              }
          }

      }
    
  },
  plus_count_my_exc(state, obj) {
      let temp = state.Exchange_mess;
      temp[obj.index].count = (++temp[obj.index].count);
      state.Exchange_mess = temp;
  },
  reduce_count_my_exc(state, obj) {
      let temp = state.Exchange_mess;
      if (temp[obj.index].count == 0) return;
      temp[obj.index].count = (--temp[obj.index].count);
      state.Exchange_mess = temp;
      //state.Post_user_msg.push(obj.id);
  },
  clear_post_mess(state) {
      state.Post_user_msg = [];
  },
  set_youyuanren_mess(state, mess) {
      console.log("1111111111111111111111111")
      console.log(mess)
      state.youyuanren_mess = mess
  },
  clear_youyuanren_mess(state, mess) {
      state.youyuanren_mess = []
  },
  set_letter_man(state, mess) {
      state.letter_man = mess;
  },
  clear_letter_man(state) {
      state.letter_man = [];
  },
  change_letter_man_click(state, index) {
      let temp = state.letter_man;
      for (let x = 0; x < state.letter_man.length; x++) {
          state.letter_man[x].click_check = false;
      }
      //if (state.letter_man[index].click_check == true) {
      //    state.letter_man[index].click_check = false;
      //    return;
      //}
      state.letter_man[index].click_check = true
  },
  header_scroll_nav(state, obj) {
      console.log("header_scroll_nav++++++++++++")
      console.log(obj)
      state.header_scroll_nav = obj;
  }
}
